package com.egg.ylt.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.egg.ylt.R;
import com.egg.ylt.SharedPreferencesUtils.SpUtils;
import com.egg.ylt.Utils.Constants;
import com.egg.ylt.Utils.CustomUtils;
import com.egg.ylt.Utils.StatusBarUtil;
import com.egg.ylt.pojo.WaterByidEntity;
import com.egg.ylt.presenter.impl.WaterPresenterImpl;
import com.egg.ylt.view.IWaterView;
import com.yonyou.framework.library.base.BaseActivity;
import com.yonyou.framework.library.bean.ErrorBean;
import com.yonyou.framework.library.common.utils.AppSharedPreferences;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ACT_WaterBathDivision extends BaseActivity<WaterPresenterImpl> implements IWaterView {

    @BindView(R.id.iv_teacher_img)
    ImageView ivTeacherImg;
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_name_experience)
    TextView tvNameExperience;
    @BindView(R.id.tv_remark)
    TextView tvRemark;
    @BindView(R.id.include_rl_view)
    RelativeLayout includeRlView;
    @BindView(R.id.ll_root)
    LinearLayout llRoot;

    @Override
    protected void getBundleExtras(Bundle extras) {

    }

    @Override
    protected int getContentViewLayoutID() {
        return R.layout.act_water_bath_division;
    }

    @Override
    protected View getLoadingTargetView() {
        return null;
    }

    @Override
    protected void initViewsAndEvents() {

        StatusBarUtil.setStatusBarColor(this, R.color.color_f3f3f3);
        StatusBarUtil.StatusBarLightMode(this);
        CustomUtils.setImmersiveStatusBar(mContext, includeRlView);

        //得到id
        String id = getIntent().getStringExtra("id");

        //取本地token
        AppSharedPreferences preferences = new AppSharedPreferences(mContext);
        String token = preferences.getString(SpUtils.USER_TOKEN);

        //请求水浴师资料
        mPresenter.getWater(Constants.TOKEN, id);

        //返回键
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

    @Override
    protected boolean isApplyStatusBarTranslucency() {
        return false;
    }

    @Override
    protected boolean isBindEventBusHere() {
        return false;
    }

    @Override
    protected boolean toggleOverridePendingTransition() {
        return false;
    }

    @Override
    protected TransitionMode getOverridePendingTransitionMode() {
        return null;
    }

    @Override
    protected boolean isApplyKitKatTranslucency() {
        return false;
    }

    @Override
    public void showBusinessError(ErrorBean error) {

    }

    @Override
    public void getWaterData(WaterByidEntity entity) {
        if (entity == null) {
            return;
        }
        //展示水浴师详情
        Glide.with(mContext)
                .load(entity.getIamgeUrl())
                .into(ivTeacherImg);
        tvNameExperience.setText(entity.getName() + "   " + entity.getExperience() + "经验");

        tvRemark.setText(entity.getRemark());
    }

}
